package com.joysuch.wwyt.mh.enums;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

public enum AlarmLimitTypeEnum {

    ALL(0,"全局"),
    SINGLE(1,"单监测点");

    private Integer type;
    private String desc;

    AlarmLimitTypeEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    private static final Map<Integer, AlarmLimitTypeEnum> lookup = new HashMap<>();

    static {
        for (AlarmLimitTypeEnum e : EnumSet.allOf(AlarmLimitTypeEnum.class)) {
            lookup.put(e.type, e);
        }
    }

    public static AlarmLimitTypeEnum find(Integer type) {
        if(null == type){
            return null;
        }
        return lookup.get(type);
    }

}
